<%@ page language="java" import="java.util.*,javaNews.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'checkAdd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
          <%        
              request.setCharacterEncoding("utf-8");
   
              MySqlNewsDaoImpl dao=new MySqlNewsDaoImpl();
              String tid = request.getParameter("ntid"); 
              int ntid=Integer.parseInt(tid);
              //int nid=Integer.parseInt(request.getParameter("nid"));
              String title=request.getParameter("ntitle");
              String author=request.getParameter("nauthor");
              String summary=request.getParameter("nsummary");
              String content=request.getParameter("ncontent");
              News cc=new News();
              cc.setNtid(ntid);cc.setNtitle(title);
              cc.setNauthor(author);cc.setNsummary(summary);
              cc.setNcontent(content);
              
              int i=dao.addNews(cc);
               if(i>0){
     %>
     <span>添加成功</span>
     <%
     }else{

      %>
           <span>添加失败</span>
      
      <% }%>
    </body>
</html>
